import request from '@/utils/request';
import * as URL from '@/constants/api';
// 登录请求
export function login(data) {
  return request({
    url: URL.LOGIN,
    method: 'post',
    data
  }).then(res => {
    // 记录token
    localStorage.setItem('token', res.data.data);
    return res.data
  })
}

export function getInfo(token) {
  return request({
    url: '/vue-element-admin/user/info',
    method: 'get',
    params: { token }
  })
}

export function logout() {
  return request({
    url: '/vue-element-admin/user/logout',
    method: 'post'
  })
}
